<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div id="app"></div>

    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>
    <script src="../js/prop-types.js"></script>


    <script type="text/babel">
       
       //App 根组件 - 子组件s  ->组件树 SPA

       //需求： 配置主题 
        class App extends React.Component{
            state = {theme:'red'}

            render(){
                const {theme} = this.state
                return (
                    <div>
                        <h1 style={{color:theme}}>App Component</h1>
                        <A1 theme={theme}/>
                        <A2 theme={theme}/>
                    </div>
                )
            }
        }

        function A1(props){
            const {theme} = props
            return (
                <div>
                    <h1 style={{color:theme}}>A1 Component</h1>
                    <B1 theme={theme}/>
                    <B2 theme={theme}/>
                </div>
            )
        }
        function A2(props){
            const {theme} = props
            return (
                <div>
                    <h1 style={{color:theme}}>A2 Component</h1>
                </div>
            )
        }

        function B1(props){
            const {theme} = props
            return (
                <div>
                    <h1 style={{color:theme}}>B1 Component</h1>

                </div>
            )
        }
        function B2(props){
            const {theme} = props
            return (
                <div>
                    <h1 style={{color:theme}}>B2 Component</h1>

                </div>
            )
        }
      
        

        ReactDOM.render(<App />, document.getElementById('app'))
    </script>
</body>

</html>